<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>订单管理</title>
	<script src="http://localhost/juanpi/Static/Admin/js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="http://localhost/juanpi/Static/Admin/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="http://localhost/juanpi/Static/Admin/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="http://localhost/juanpi/Static/Admin/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="http://localhost/juanpi/Static/Admin/hdjs/hdjs.css"/>
    <link type="text/css" rel="stylesheet" href="http://localhost/juanpi/Static/Admin/css/common.css"/>
    <script type="text/javascript">
		$(function(){
			$('.open').toggle(function(){
				$(this).removeClass('glyphicon-plus').addClass('glyphicon-minus');
				$(this).parents('tr').siblings('tr').show(250);
			}, function(){
				$(this).removeClass('glyphicon-minus').addClass('glyphicon-plus');
				$(this).parents('tr').siblings('tr').hide(250);
			});
		});
	</script>
</head>
<body>
<div class="wrap">
    <table class="hd-table hd-table-list">
        <thead>
        <tr>
        	<td width="30"></td>
            <td width="100">订单id</td>
            <td>订单号</td>
            <td width="100">收货人</td>
            <td width="200">地址</td>
            <td width="100">总价</td>
            <td width="180">添加时间</td>
            <td width="100">发货状态</td>
            <td width="150">操作</td>
        </tr>
        </thead>
        
        <?php foreach ($order as $k=>$v){?>
        	<tbody>
            <tr class="order" style="background: #CEE6FE;">
        	<td width="30">
            	<a href="javascript:;" class="glyphicon glyphicon-plus open" cid='<?php echo $v['cid'];?>'></a>
            </td>
            <td width="100"><?php echo $k;?></td>
            <td><?php echo $v['number'];?></td>
            <td width="100"><?php echo $v['consignee'];?></td>
            <td width="200"><?php echo $v['address'];?></td>
            <td width="100"><?php echo $v['total'];?></td>
            <td width="180"><?php echo date('Y-m-d H:i:s',$v['time']);?></td>
            <td width="100"><?php echo $v['status'];?></td>
            <td width="150">
            	    <?php if($v['status'] == '已付款'){ ?>
            		<a href="<?php echo U('release',array('oid'=>$v['oid']));?>" class="hd-btn hd-btn-primary hd-btn-sm">发货</a>
				<?php } ?>
				    <?php if($v['status'] == '已接收'){ ?>
            		<a href="javascript:;" class="hd-btn hd-btn-success hd-btn-sm">完成</a>
				<?php } ?>
				<a href="javascript:del_modal(<?php echo $v['oid'];?>);" class="hd-btn hd-btn-danger hd-btn-sm">删除</a>
            </td>
        	</tr>
        	<!--商品列表-->
        	<tr style="background: #FFA3BB;display: none;">
        		<td width="30"></td>
	            <td width="100">订单列表ID</td>
	            <td>商品名称</td>
	            <td width="100">图片</td>
	            <td width="200">购买数量</td>
	            <td width="100">规格</td>
	            <td width="180">添加时间</td>
	            <td width="100">小计</td>
	            <td width="150"></td>
	        </tr>
        	<?php foreach ($v['list'] as $key=>$value){?>
	        	<tr style="background: #F6F6F6;display: none;">
	        	<td width="30"></td>
	            <td width="100"><?php echo $value['olid'];?></td>
	            <td><?php echo $value['gname'];?></td>
	            <td width="100"><img width="50" src="http://localhost/juanpi/<?php echo $value['img'];?>"/></td>
	            <td width="200"><?php echo $value['quantity'];?></td>
	            <td width="100"><?php echo $value['spec'];?></td>
	            <td width="180"><?php echo date('Y-m-d H:i:s',$v['time']);?></td>
	            <td width="100"><?php echo $value['subtotal'];?></td>
	            <td width="150"></td>
	        	</tr>
	        <?php }?>
	        	</tbody>
    	<?php }?>
       
    </table>
    <style type="text/css">
    		.page_hdjob{
    			margin-top: 20px;
    			text-align: center;
    			font-size: 14px;
    			color: #333;
    		}
    		.page_hdjob a{
    			font-size: 14px;
    			color: #333;
    			padding: 3px 5px;
    			margin-left: 3px;
    			border: 1px solid #CCCCCC;
    			
    		}
    		.page_hdjob strong{
    			padding: 3px 5px;
    			margin-left: 3px;
    			background: red;
    			color: white;
    		}
    </style>
    <div class="page_hdjob">
      <?php echo $page;?>
    </div>
</div>

</body>
<script type="text/javascript">
	function del_modal(oid){
		hd_modal({
            width: 400,//宽度
            height: 120,//高度
            title: '确认删除吗？',//标题
            content: '',//提示信息
            button: true,//显示按钮
            button_success: "确定",//确定按钮文字
            button_cancel: "取消",//关闭按钮文字
            timeout: 0,//自动关闭时间 0：不自动关闭
            shade: true,//背景遮罩
            shadeOpacity: 0.3,//背景透明度
            success: function () {//点击确定后的事件
				location.href='<?php echo U("del");?>' + '&oid=' + oid;
            },
            cancel: function () {//点击关闭后的事件

            }
        });
	}	
</script>
</html>


